﻿using System;
using System.Net;
using System.Xml.Linq;
using System.Linq;

namespace ArmoryBrowser.Entities
{
    public class SpellDamageBonuses
    {
        #region Fields
        private string _arcaneField;
        private string _fireField;
        private string _frostField;
        private string _holyField;
        private string _natureField;
        private string _shadowField;
        private SpellPetBonus _petBonusField;
        #endregion
        #region Properties
        public string Arcane
        {
            get
            {
                return this._arcaneField;
            }
            set
            {
                this._arcaneField = value;
            }
        }

        public string Fire
        {
            get
            {
                return this._fireField;
            }
            set
            {
                this._fireField = value;
            }
        }

        public string Frost
        {
            get
            {
                return this._frostField;
            }
            set
            {
                this._frostField = value;
            }
        }

        public string Holy
        {
            get
            {
                return this._holyField;
            }
            set
            {
                this._holyField = value;
            }
        }

        public string Nature
        {
            get
            {
                return this._natureField;
            }
            set
            {
                this._natureField = value;
            }
        }

        public string Shadow
        {
            get
            {
                return this._shadowField;
            }
            set
            {
                this._shadowField = value;
            }
        }

        public SpellPetBonus PetBonus
        {
            get
            {
                return this._petBonusField;
            }
            set
            {
                this._petBonusField = value;
            }
        }
        #endregion
        #region Constructor
        public SpellDamageBonuses(XElement element)
        {
            Arcane = element.Elements("arcane").Select(e => e.GetAttributeValue("value")).FirstOrDefault();
            Fire = element.Elements("fire").Select(e => e.GetAttributeValue("value")).FirstOrDefault();
            Frost = element.Elements("frost").Select(e => e.GetAttributeValue("value")).FirstOrDefault();
            Holy = element.Elements("holy").Select(e => e.GetAttributeValue("value")).FirstOrDefault();
            Nature = element.Elements("nature").Select(e => e.GetAttributeValue("value")).FirstOrDefault();
            Shadow = element.Elements("shdow").Select(e => e.GetAttributeValue("value")).FirstOrDefault();
            PetBonus = element.Elements("petBonus").Select(e => new SpellPetBonus(e)).FirstOrDefault();
        }
        #endregion
    }
}
